package top.oauth2.sms.enums;

import lombok.AllArgsConstructor;
import org.apache.commons.lang.StringUtils;

/**
 * @author xphu
 * @version 1.0
 * @date 2021/9/16 11:39
 */
@AllArgsConstructor
public enum SmsTypeEnum {

    /**
     * 短信提供商类型
     */
    SMS_TYPE_TX("TX", "鹅厂", "penguinSmsService"),
    SMS_TYPE_AL("AL", "阿里", "aliSmsService"),

    ;

    public String type;
    public String name;
    public String serviceName;

    public static SmsTypeEnum getSmsType(String type){
        if (StringUtils.isEmpty(type)){
            return null;
        }
        for (SmsTypeEnum value : SmsTypeEnum.values()) {
            if (value.type.equals(type)) {
                return value;
            }
        }
        return null;
    }
}
